﻿using FlickrNet;
using Lsk.Business;
using Lsk.Business.DTO;
using Lsk.Data;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;

namespace lsk.Web.Api
{
    public class CareerController : ApiController
    {
        [HttpGet]
        public IEnumerable<String> GetJobPositions()
        {
            Career careerManager = new Career();
            return careerManager.GetJobPositions();
        }

        [HttpGet]
        public String GetJobDescription()
        {
            Setting settingManager = new Setting();
            return settingManager.GetSetting().Module21;
        }


        [HttpPost]
        public HttpResponseMessage save(dynamic data)
        {
            JobCandidateParameter entry = JsonConvert.DeserializeObject<JobCandidateParameter>(data.ToString());
            UserSubmitInfo usi = new UserSubmitInfo();
            int retval = usi.SaveJobCandidate(entry);
            return Request.CreateResponse(HttpStatusCode.OK, retval);   // if success, return the id.
        }    
     }
}
